import { ErrorMatchHandler } from "../apollo/error-handler";
import {
  ForbiddenErrorHandler,
  GraphQLErrorMatchHandler,
  InputValidationErrorHandler,
  ServerErrorHandler,
  UnauthorizedErrorHandler,
} from "../apollo/graphql-error-handler";
import {
  DefaultNetworkErrorHandler,
  NetworkErrorMatchHandler,
} from "../apollo/network-error-handler";

export const createNetworkErrorHandlers = (): NetworkErrorMatchHandler[] => {
  return [new DefaultNetworkErrorHandler()];
};

export const createGraphQLServerErrorHandlers =
  (): GraphQLErrorMatchHandler[] => {
    return [
      new UnauthorizedErrorHandler(),
      new InputValidationErrorHandler(),
      new ForbiddenErrorHandler(),
      new ServerErrorHandler(),
    ];
  };

export const createBrowserErrorHandlers = (): ErrorMatchHandler[] => {
  return [];
};
